var express = require('express');
var router = express.Router();

// //后端解决跨域	cors
// router.all('*', function (req, res, next) {
//     res.header('Access-Control-Allow-Origin', '*');
//     //Access-Control-Allow-Headers ,可根据浏览器的F12查看,把对应的粘贴在这里就行
//     res.header('Access-Control-Allow-Headers', 'Content-Type');
//     res.header('Access-Control-Allow-Methods', '*');
//     res.header('Content-Type', 'application/json;charset=utf-8');
//     next();
// });

/* GET home page. */
router.get('/', function(req, res, next) {
	res.render('index', {
		title: 'Express'
	});
});

// 首页 ===> 推荐的  1  的数据
router.get('/api/index_list/0/data/1', function(req, res, next) {

	res.send({
		code: 0,
		data: {
			topBar: [{
					id:0,
					label: '推荐'
				},
				{
					id:1,
					label: '大红袍'
				},
				{
					id:2,
					label: '铁观音'
				},
				{
					id:3,
					label: '绿茶'
				},
				{
					id:4,
					label: '红茶'
				},
				{
					id:5,
					label: '黑茶'
				},
				{
					id:6,
					label: '茶具'
				}
			],
			data:[
				{
					id:0,
					type:'swiperList',
					data:[
						{id:0,imgUrl:'./images/swiper1.jpeg'},
						{id:1,imgUrl:'./images/swiper2.jpeg'},
					]
				},
				{
					id:1,
					type:'iconsList',
					data:[
						{
							id:0,
							title:'自饮茶',
							imgUrl:'./images/icons1.png',
						},
						{
							id:1,
							title:'茶具',
							imgUrl:'./images/icons2.png',
						},
						{
							id:2,
							title:'茶礼盒',
							imgUrl:'./images/icons3.png',
						},
						{
							id:3,
							title:'领福利',
							imgUrl:'./images/icons4.png',
						},
						{
							id:4,
							title:'官方验证码',
							imgUrl:'./images/icons5.png',
						},
					]
				},
				{
					id:2,
					type:'likeList',
					data:[
						{
							id:0,
							title:'消青工艺浓香铁观音1号',
							price:'299',
							imgUrl:'./images/like.jpeg',
						},
						{
							id:1,
							title:'武夷山高级岩茶大红袍 2号1号',
							price:'33',
							imgUrl:'./images/like2.jpeg',
						},
						{
							id:2,
							title:'消青工艺浓香铁观音1号',
							price:'299',
							imgUrl:'./images/like3.jpeg',
						},
						{
							id:3,
							title:'武夷山高级岩茶大红袍 2号1号',
							price:'33',
							imgUrl:'./images/like5.jpeg',
						},
						{
							id:4,
							title:'武夷山高级岩茶大红袍 2号1号',
							price:'33',
							imgUrl:'./images/like6.jpeg',
						},
						{
							id:5,
							title:'消青工艺浓香铁观音1号',
							price:'299',
							imgUrl:'./images/like7.jpeg',
						},
						// {
						// 	id:6,
						// 	title:'武夷山高级岩茶大红袍 2号1号',
						// 	price:'33',
						// 	imgUrl:'./images/like9.jpeg',
						// },
						// {
						// 	id:7,
						// 	title:'武夷山高级岩茶大红袍 2号1号',
						// 	price:'33',
						// 	imgUrl:'./images/like10.jpeg',
						// },
					]
				},
			]
		
		}
	})

})

// 首页 ===> 大红袍  1  的数据
router.get('/api/index_list/1/data/1', function(req, res, next) {

	res.send({
		code: 0,
		data:[
			{
				id:1,
				type:'iconsList',
				data:[
					{
						id:0,
						title:'自饮茶',
						imgUrl:'./images/icons1.png',
					},
					{
						id:1,
						title:'茶具',
						imgUrl:'./images/icons2.png',
					},
					{
						id:2,
						title:'茶礼盒',
						imgUrl:'./images/icons3.png',
					},
					{
						id:3,
						title:'领福利',
						imgUrl:'./images/icons4.png',
					},
					{
						id:4,
						title:'官方验证码',
						imgUrl:'./images/icons5.png',
					},
				]
			},
		]
				
	})

})

// 首页 ===> 铁观音  1  的数据
router.get('/api/index_list/2/data/1', function(req, res, next) {

	res.send({
		code: 0,
		data:[
			{
				id:0,
				type:'swiperList',
				data:[
					{id:0,imgUrl:'./images/swiper1.jpeg'},
					{id:1,imgUrl:'./images/swiper2.jpeg'},
				]
			},
		]
				
	})


})



module.exports = router;
